package com.yigang.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yigang.dao.ParameterDao;
import com.yigang.entity.Parameter;
import com.yigang.service.ParameterService;
import com.yigang.utils.ResultUtil;
@Service
@Transactional
public class ParameterServiceImpl implements ParameterService{
	@Autowired
	private ParameterDao parameterDao;
	@Override
	public ResultUtil selectParameterList(Integer page, Integer limit, Parameter record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(page, limit);
		List<Parameter> parameter = parameterDao.selectParameterList(record);
		PageInfo<Parameter> pageInfo = new PageInfo<Parameter>(parameter);
		ResultUtil resultUtil = new ResultUtil();
		resultUtil.setCode(0);
		resultUtil.setCount(pageInfo.getTotal());
		resultUtil.setData(pageInfo.getList());
		return resultUtil;
	}

	@Override
	public ResultUtil deleteByPrimaryKey(Integer parameter_id) {
		// TODO Auto-generated method stub
		parameterDao.deleteByPrimaryKey(parameter_id);
		return ResultUtil.ok();
	}

	@Override
	public ResultUtil insertSelective(Parameter record) {
		// TODO Auto-generated method stub
		parameterDao.insertSelective(record);
		return ResultUtil.ok();
	}

	@Override
	public ResultUtil updateByPrimaryKeySelective(Parameter record) {
		// TODO Auto-generated method stub
		parameterDao.updateByPrimaryKeySelective(record);
		return ResultUtil.ok();
	}

	@Override
	public Parameter selectParameterById(int parameter_id) {
		// TODO Auto-generated method stub
		return parameterDao.selectParameterById(parameter_id);
	}

}
